/*
 * CollaborativeWorks.java
 *
 * Created on November 9, 2008, 6:18 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package jollylengkono.skripsi.model;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import org.apache.struts.validator.ValidatorForm;

/**
 * Entity class CollaborativeWorks
 * 
 * @author JollkY
 */
@Entity
public class CollaborativeWorks extends ValidatorForm implements Serializable {

    @ManyToMany(mappedBy = "collaborativeWork")
    private List<Members> listWorker;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private String title;
    @ManyToOne
    private CollaborativeWorksSubject subject;
    private String writes; //date
    private String publishes; //date
    private String updates; //date
    @ManyToOne
    private Members creator;
    private String hasDocument;
    private String shortDescription;
    private String fullContent;
    private long downloaded;
    private String status;
    
    /** Creates a new instance of CollaborativeWorks */
    public CollaborativeWorks() {
    }

    /**
     * Gets the id of this CollaborativeWorks.
     * @return the id
     */
    public Long getId() {
        return this.id;
    }

    /**
     * Sets the id of this CollaborativeWorks to the specified value.
     * @param id the new id
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * Returns a hash code value for the object.  This implementation computes 
     * a hash code value based on the id fields in this object.
     * @return a hash code value for this object.
     */
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }

    /**
     * Determines whether another object is equal to this CollaborativeWorks.  The result is 
     * <code>true</code> if and only if the argument is not null and is a CollaborativeWorks object that 
     * has the same id field values as this object.
     * @param object the reference object with which to compare
     * @return <code>true</code> if this object is the same as the argument;
     * <code>false</code> otherwise.
     */
    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CollaborativeWorks)) {
            return false;
        }
        CollaborativeWorks other = (CollaborativeWorks)object;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) return false;
        return true;
    }

    /**
     * Returns a string representation of the object.  This implementation constructs 
     * that representation based on the id fields.
     * @return a string representation of the object.
     */
    @Override
    public String toString() {
        return "jollylengkono.skripsi.model.CollaborativeWorks[id=" + id + "]";
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public CollaborativeWorksSubject getSubject() {
        return subject;
    }

    public void setSubject(CollaborativeWorksSubject subject) {
        this.subject = subject;
    }

    public String getWrites() {
        return writes;
    }

    public void setWrites(String writes) {
        this.writes = writes;
    }

    public String getPublishes() {
        return publishes;
    }

    public void setPublishes(String publishes) {
        this.publishes = publishes;
    }

    public String getUpdates() {
        return updates;
    }

    public void setUpdates(String updates) {
        this.updates = updates;
    }

    public Members getCreator() {
        return creator;
    }

    public void setCreator(Members creator) {
        this.creator = creator;
    }

    public String getHasDocument() {
        return hasDocument;
    }

    public void setHasDocument(String hasDocument) {
        this.hasDocument = hasDocument;
    }

    public String getShortDescription() {
        return shortDescription;
    }

    public void setShortDescription(String shortDescription) {
        this.shortDescription = shortDescription;
    }

    public String getFullContent() {
        return fullContent;
    }

    public void setFullContent(String fullContent) {
        this.fullContent = fullContent;
    }

    public long getDownloaded() {
        return downloaded;
    }

    public void setDownloaded(long downloaded) {
        this.downloaded = downloaded;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public List<Members> getListWorker() {
        return listWorker;
    }

    public void setListWorker(List<Members> listWorker) {
        this.listWorker = listWorker;
    }
    
//    @Override
//    public void reset(ActionMapping mapping, HttpServletRequest request) {
//        // not now
//    }
    
}
